<template>
	<div class="container">
		<!-- 头部标题栏 -->
		<h3 class="header-title clearfix">
			<span></span>
			<p>发才网人才库</p>
		</h3>
		<!-- 搜索栏 -->
		<comSearch :options="search" @searchList="searchData"></comSearch>
		<!-- 新增资料 -->
		<matMgAddMsg ref="material" :options="material" @addMaterial="addMaterial" v-show="false"></matMgAddMsg>
		<!-- 数据列表 -->
		<comTable :options="tableData" @openDetailsDialog="function (data) { return openDetailsDialog('明细', data) }"
			class="addTab" @openRemarksDialog="function (data) { return openDetailsDialog('备注', data) }"
			@addRemarks="addRemarks" @openResume="openResume" @openUpload="openUpload" @recovery="recovery"
			@openModifyArrange="function (data) { return openModifyDialog(data, 'arrange') }" @openModifyName="openResumeDetail"
			@openModifyTelnum="function (data) { return openModifyDialog(data, 'telnum') }"
			@openModifySex="function (data) { return openModifyDialog(data, 'sex') }"
			@openModifyAge="function (data) { return openModifyDialog(data, 'age') }"
			@openModifyEducation="function (data) { return openModifyDialog(data, 'education') }"
			@openModifyNativePlace="function (data) { return openModifyDialog(data, 'nativePlace') }"
			@openModifyPresentAddress="function (data) { return openModifyDialog(data, 'presentAddress') }"
			@openModifyPosition="function (data) { return openModifyDialog(data, 'position') }"
			@openModifyWorkStatus="function (data) { return openModifyDialog(data, 'workStatus') }"
			@openModifyProjectBelongs="function (data) { return openModifyDialog(data, 'projectBelongs') }"
			@openModifyrecruitmentChannel="function (data) { return openModifyDialog(data, 'recruitmentChannel') }"
			@openModifyProjectHiredate="function (data) { return openModifyDialog(data, 'hiredate') }"
			@editeInterviewTime="function (data) { return openModifyDialog(data, 'interviewTime') }"
			@openModifyregion="function (data) { return openModifyDialog(data, 'region') }"
			@openModifyNativecardNum="function (data) { return openModifyDialog(data, 'cardNum') }"
			@openModifytradeName="function (data) { return openModifyDialog(data, 'tradeName') }"
			@openModifyjobName="function (data) { return openModifyDialog(data, 'jobName') }"
			@openModifysalaryExpectation="function (data) { return openModifyDialog(data, 'salaryExpectation') }"
			@openModifyoriginalCompany="function (data) { return openModifyDialog(data, 'originalCompany') }"
			@openModifyoriginalCity="function (data) { return openModifyDialog(data, 'originalCity') }"
			@openModifyannualSalary="function (data) { return openModifyDialog(data, 'annualSalary') }"
			@recruitmentStatus2="recruitmentStatus2" @recruitmentStatus1="recruitmentStatus1"></comTable>
		<!-- 修改明细弹窗 -->
		<comDetails :options="detailsData" @getDetailsList="getDetailsList"></comDetails>
		<!-- 新增备注弹窗 -->
		<perMgAddRemarks ref="remark" :options="remarksData" @subRemarks="subRemarks"></perMgAddRemarks>
		<!-- 简历模板弹窗 -->
		<comResume :options="remuseData"></comResume>
		<!-- 上传简历弹窗 -->
		<matMgUploadResume :options="uploadData" @updateView="updateView"></matMgUploadResume>
		<!-- 修改资料弹窗 -->
		<matMgUpdateData :options="updateData" @updateData="modifyData"></matMgUpdateData>

		<el-dialog :visible.sync="toolDialog.exportShow" :before-close="handleClose" :width="widPersnt">
			<div class="inputBox" v-show="toolDialog.title == '招聘信息录入'">
				<h3 class="inputIcon">招聘信息录入</h3>
				<el-form :inline="true" :model="formUser" class="demo-form-inline" label-width="125px"
					v-show="widPersnt == '60%'">
					<el-form-item v-for="item in formItem.item" :label="item.label" class="itemForm">
						<el-input v-model="formExport[item.title]" :placeholder="item.placeholder" class="width"
							v-show="item.label != '项目归属' && item.label != '状态' && item.label != '备注' && item.label != '面试时间' && item.label != '简历' && item.label != '职能'">
						</el-input>
						<el-select v-model="formExport[item.title]" placeholder="请选择项目" filterable clearable class="width"
							v-show="item.label == '项目归属'" @change="getLabel">
							<el-option v-for="(item, index) in belongList" :label="item.projectBlongs" :value="item.projectId"
								:key="index"></el-option>
						</el-select>

						<p class="pBox" v-show="item.label == '简历'">
							<span class="upIcon el-icon-upload2" @click="uploadResume(formExport)"
								v-show="!remuseData.list.length > 0">上传简历</span>
							<span class="upIcon el-icon-folder-opened" @click="lookResume(formExport)"
								v-show="remuseData.list.length > 0">查看简历</span>

						</p>
						<el-select v-model="formExport[item.title]" placeholder="请选择工作状态" v-show="item.label == '状态'"
							@change="getType" class="width">
							<el-option label="沟通" value="1"></el-option>
							<el-option label="通知面试" value="2"></el-option>
							<el-option label="实到面试" value="3"></el-option>
							<el-option label="通知复试" value="4"></el-option>
							<el-option label="实到复试" value="5"></el-option>
							<el-option label="录取" value="6"></el-option>
							<el-option label="到岗" value="7"></el-option>
						</el-select>

						<el-cascader ref="cascader" v-model="formSeach.tradeCode" class="width" :options="workersList" clearable
							@change="handleChangeCode(formSeach.tradeCode, '22')" v-if="item.label == '职能'">
						</el-cascader>


						<el-input type="textarea" v-model="formExport[item.title]" class="width" v-show="item.label == '备注'">
						</el-input>
						<el-date-picker v-model="serchKey" type="datetime" placeholder="选择面试时间" class="width"
							v-show="item.label == '面试时间'">
						</el-date-picker>

					</el-form-item>


				</el-form>
				<p class="textAl"><button class="serchBtn exporBtn" @click="sureEnter" v-show="widPersnt == '60%'"
						v-preventClick>确认导入</button></p>
				<div v-show="widPersnt == '30%'" class="markBox">
					<h5 class="centerH5">{{ markObj.createTime }}</h5>
					<p class="markArea">录入人:{{ markObj.userName }}</p>
				</div>
			</div>


		</el-dialog>

		<el-dialog :visible.sync="dialogVisible" width="1040px">
			<resume-detail v-if="dialogVisible" :userid="useridResume" :nickName="nickNameResume"
				:isShowTelphone="true"></resume-detail>
		</el-dialog>


		<!-- 分页器 -->
		<div class="pageBox">
			<el-pagination @size-change="handleSizeChange" @current-change="pageChange" :current-page="cur"
				:page-sizes="[10, 20, 30, 50, 100]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
				:total="totalNum" background></el-pagination>
		</div>
	</div>
</template>

<script>
export default {
	components: {
		resumeDetail: () => import("@/component/resumeDetail/index.vue"),
		comSearch: () => import("../commonComponents/comSearch.vue"),
		matMgAddMsg: () => import("../pageComponents/matMgAddMsg.vue"),
		comTable: () => import("../commonComponents/comTable.vue"),
		comResume: () => import("../commonComponents/comResume.vue"),
		comDetails: () => import("../commonComponents/comDetails.vue"),
		perMgAddRemarks: () => import("../pageComponents/perMgAddRemarks.vue"),
		matMgUploadResume: () => import("../pageComponents/matMgUploadResume.vue"),
		matMgUpdateData: () => import("../pageComponents/matMgUpdateData.vue"),
	},
	data() {
		return {
			dialogVisible: false,
			/* 搜索列表 */
			widPersnt: '60%',
			formUser: {
				name: '',
			},
			serchKey: '',
			formSeach: {
				name: '',
				sex: '',
				telnum: '',
				jobName: '',
				region: '',
				tradeCode: '',
				tradeName: '',
				pageNum: this.cur,
				pageSize: this.pageSize,
			},
			formExport: {
				userName: localStorage.getItem('checkHuman'),
				userId: localStorage.getItem('userid'),
				name: '',
				librarianId: '',
				telnum: "",
				sex: "",
				librarianId: "",
				age: "",
				region: "",
				cardNum: "",
				tradeName: "",
				jobName: "",
				salaryExpectation: "",
				originalCompany: "",
				originalCity: "",
				annualSalary: "",
				type: "3",
				belows: '',
				projectBelongs: '',
				projectBelong: '',
				comment: '',
				workStatus: '',
				projectId: '',
				nickname: '',
				appUserid: '',
				inputName: '',
				slist: [],


			},
			search: {
				userShow: true, //姓名
				telShow: true, //电话号码
				// tagShow: true,												//标注
				sexShow: true, //性别
				// ageShow: true,												//年龄
				// educationShow: true,										//学历
				// addressShow: true,											//现住址
				workStatusShow: true, //工作状态
				postShow: true, //岗位
				projectShow: true, //项目归属
				startOperationTimeShow: true,
				tradeName: true,
				region: true,
				jobName: true,

				// entryShow: true,											//录入时间
				data: {}, //查询数据
			},
			/* 录入资料数据 */
			material: {

			},
			toolDialog: {
				exportShow: false,
				title: '招聘信息录入',

			},
			markObj: {},

			formItem: {
				item: [{
					label: '姓名',
					placeholder: '请输入姓名',
					title: 'name',
				},
				{
					label: '项目归属',
					placeholder: '请输入项目归属',
					title: 'projectBelong',
				},
				{
					label: '性别',
					placeholder: '请输入性别',
					title: 'sex',
				},
				{
					label: '年龄',
					placeholder: '请输入年龄',
					title: 'age',
				},
				{
					label: '简历',
					title: 'reuseme',
				},
				{
					label: '手机号码',
					placeholder: '请输入手机号码',
					title: 'telnum',
				},
				{
					label: '状态',
					placeholder: '请选择状态',
					title: 'workStatus',
				},

				{
					label: '居住地',
					placeholder: '请输入居住地',
					title: 'region',
				},
				{
					label: '面试时间',
					placeholder: '请输入面试时间',
					title: 'interviewTime',
				},
				{
					label: '身份证号码',
					placeholder: '请输入身份证号码',
					title: 'cardNum',
				},
				{
					label: '职能',
					placeholder: '请选择职能',
					title: 'tradeName',
				},
				{
					label: '期望薪资',
					placeholder: '请输入期望薪资',
					title: 'salaryExpectation',
				},
				{
					label: '原工作单位',
					placeholder: '请输入原工作单位',
					title: 'originalCompany',
				},
				{
					label: '原工作城市',
					placeholder: '请输入原工作城市',
					title: 'originalCity',
				},
				{
					label: '原年薪',
					placeholder: '请输入原年薪',
					title: 'annualSalary',
				},
				{
					label: '跳槽意向程度',
					placeholder: '请输入跳槽意向程度',
					title: 'hoppingIntention',
				},
				{
					label: '备注',
					placeholder: '请输入备注',
					title: 'comment',
				},

				],

			},
			toolDialog: {
				exportShow: false,
				title: '招聘信息录入',

			},
			/* 列表数据 */
			tableData: {
				list: [
					// {title: '标注',prop: 'arrange',isClick: true,eventName: 'openModifyArrange'},
					{
						title: '会员ID',
						prop: 'tdaccount',
						isClick: false,
						eventName: 'openModifyName'
					},
					{
						title: '会员名称',
						prop: 'nickname',
						isClick: true,
						eventName: 'openModifyName'
					},
					{
						title: '实名姓名',
						prop: 'realname',
						isClick: false,
						eventName: 'openModifyName'
					},
					{
						title: '身份证号码',
						prop: 'cardnum',
						isClick: false,
						eventName: 'openModifyNativecardNum'
					},

					{
						title: '性别',
						prop: 'sex',
						isClick: false,
						eventName: 'openModifySex'
					},
					{
						title: '出生日期',
						prop: 'birthdate',
						isClick: false,
						eventName: 'openModifyNativecardNum'
					},
					// {title: '年龄',prop: 'age',isClick: true,eventName: 'openModifyAge'},
					{
						title: '居住地',
						prop: 'region',
						isClick: false,
						eventName: 'openModifyregion'
					},
					// {title: '职能',prop: 'tradeName',isClick: true,eventName: 'openModifytradeName'},
					// {title: '职位名称',prop: 'jobName',isClick: true,eventName: 'openModifyjobName'},
					// {title: '期望薪资',prop: 'salaryExpectation',isClick: true,eventName: 'openModifysalaryExpectation'},
					// {title: '原工作单位',prop: 'originalCompany',isClick: true,eventName: 'openModifyoriginalCompany'},
					// {title: '原工作城市',prop: 'originalCity',isClick: true,eventName: 'openModifyoriginalCity'},
					// {title: '原年薪',prop: 'annualSalary',isClick: true,eventName: 'openModifyannualSalary'},

					{
						title: '手机号',
						prop: 'telnum',
						isClick: false,
						eventName: 'openModifyTelnum'
					},
					{
						title: '学历',
						prop: 'education',
						isClick: false,
						eventName: 'openModifyWorkStatus'
					},
					{
						title: '求职状态',
						prop: 'workStatus',
						isClick: false,
						eventName: 'openModifyWorkStatus'
					},
					{
						title: '注册时间',
						prop: 'registertime',
						isClick: false,
						eventName: 'openModifyProjectBelongs'
					},

					// {
					// 	title: '招聘渠道',
					// 	prop: 'recruitmentChannel',
					// 	isClick: true,
					// 	eventName: 'openModifyrecruitmentChannel'
					// },
					// {
					// 	title: '操作时间',
					// 	prop: 'updateTime',
					// 	isClick: true,
					// 	eventName: 'openModifyProjectHiredate'
					// },
					// {
					// 	title: '面试时间',
					// 	prop: 'interviewTime',
					// 	isClick: true,
					// 	eventName: 'editeInterviewTime'
					// },
					// {
					// 	title: '最新备注',
					// 	prop: 'projectRemark',
					// 	isClick: true,
					// 	eventName: 'addRemarks'
					// },
					// {title: '历史备注',prop: 'oldRemarks',isClick: false},
					// {title: '录入时间',prop: 'createTime',isClick: false},
				],
				operationBtn: true,
				noResume: false, //简历
				resumeList: [
					// {
					// 		name: '查看简历',
					// 		isBtn: false,
					// 		title: 'openResume'
					// 	},
					// 	{
					// 		name: '上传简历',
					// 		isBtn: false,
					// 		title: 'openUpload'
					// 	},
				],
				noOperation: false, //有操作项
				operation: [ //操作项内容
					{
						name: '招聘信息录入',
						isBtn: false,
						title: 'openDetailsDialog'
					},
					{
						name: '招聘信息已录入',
						isBtn: false,
						title: 'openRemarksDialog'
					},
					// {
					// 	name: '放入回收站',
					// 	isBtn: false,
					// 	title: 'recovery'
					// },
				],
				workersList: [],
				data: [
					/* {
						arrange: '已安排',
						name: '徐凤年',
						telnum: '156565656',
						position: '月嫂',
						workStatus: '在职',
						projectBelongs: '发财网络科技有限公司',
						newRemarks: 'xxx',
						oldRemarks: 'xxx',
						createTime: '2020-1-55',
						resume: '查看简历'
					}, */
				]
			},
			/* 明细弹窗数据 */
			detailsData: {
				showDialog: false, //显示弹窗
				title: '修改明细', //标题
				list: [ //数据列表
					/* {	
						title: '2020年09月11日10:41:54',						//标题
						content: '修改手机号码：15202120781 为 手机号码：120383774748',	//内容
					}, */
				]
			},
			/* 添加备注弹窗 */
			remarksData: {
				showDialog: false, //显示弹窗
				title: '添加备注', //标题
			},
			/* 简历模板数据 */
			remuseData: {
				showDialog: false, //显示弹窗
				title: '简历列表', //标题
				list: [
					/* {
						title: '一、简历',
					} */
				],
				userInfo: {}, //当前被操作人员信息
			},
			belongList: [],
			projectId: '',
			/* 上传简历数据 */
			uploadData: {
				showDialog: false, //显示弹窗
				title: '上传简历', //标题
				fileList: [], //上传简历列表
			},
			/* 修改资料数据 */
			updateData: {
				showDialog: false, //显示弹窗
				title: '修改资料信息', //标题
				type: '', //修改类型
				userInfo: {}, //当前被操作人员信息
				recruitmentChannelList: []
			},

			nickNameResume: '',
			useridResume: '',
			/* 分页功能数据 */
			cur: 1,
			pageSize: 10,
			totalNum: 0, //总共有多少条数据,根据这个数据去适配页数
		}
	},
	created() {
		this.init();
	},
	methods: {
		openResumeDetail(row) {
			console.log(row)
			this.$axios
        .post("app//v1/librarian/resumeInfo", {
          userid: this.userid,
          type: "1",
          vitaeid:''
        })
				.then(res => {
					if (res.data.code == 180) {
						return this.$message({
							message: '该用户未填写简历信息！',
							type: "warning"
						});
					} else {
						this.useridResume = row.userid;
						this.nickNameResume = row.nickname;
						this.dialogVisible = true;
					}
				})

		},
		lookResume(row) {
			console.log(row);
			this.remuseData.userInfo = row
			this.remuseData.showDialog = true
			this.$telAxios.post('/v1/librarian/selectFlexibileResumeList', {
				librarianId: row.librarianId
			}).then(res => {
				console.log(res);
				if (res.data.code === 1000) {
					this.remuseData.list = res.data.data;
				} else {
					this.$message({
						message: res.data.message,
						type: 'warning'
					})
				}
			})
		},
		uploadResume(row) {
			console.log(row);
			this.uploadData.userInfo = row
			this.uploadData.showDialog = true
		},
		handleClose() {
			this.toolDialog.exportShow = false
		},
		sureEnter() {
			console.log(this.formExport);
			let slist = []
			slist.push(this.formExport.comment)
			this.formExport.slist = slist
			this.formExport.userName = localStorage.getItem('checkHuman')
			this.formExport.userId = localStorage.getItem('userid')
			this.formExport.projectId = this.projectBlongsObj
			this.formExport.type = 3

			this.belongList.forEach(res => {
				if (res.projectId == this.projectBlongsObj) {
					this.formExport.projectBelongs = res.projectBlongs
					console.log(this.formExport.projectBelongs);
				}
			})
			// Object.assign(this.formExport,{slist})
			delete this.formExport['plist'];
			this.formExport.recruitmentStatus = '2'
			this.formExport.userId = localStorage.getItem('userid')

			this.$ceshiAxios.post('v1/librarian/inserLibrarian', this.formExport).then(res => {
				console.log(res);
				if (res.data.code === 1000) {
					this.toolDialog.exportShow = false
					this.$message.success('操作成功 ')
					this.formSeach.tradeCode = []
				}
			})
		},
		getSearchList(mark) {
			let data = {}

			let url = '/v1/librarian/projectBelongsList'
			this.$telAxios.get(url, data).then(res => {
				this.belongList = res.data.data
			})
		},
		getLabel(data) {
			// this.=data.projectBlongs
			this.projectBlongsObj = data
		},
		getType(data) {
			console.log(data);

		},
		recruitmentStatus2(data) {
			this.formExport = data
			console.log(data);
			this.widPersnt = '30%'
			this.$ceshiGetAxios('v1/librarian/inputLog', { appUserid: data.userid }).then(res => {
				this.markObj = res.data.data
			})
			this.toolDialog.exportShow = true
		},
		recruitmentStatus1(data) {
			// userName: localStorage.getItem('checkHuman'),
			// userId: localStorage.getItem('userid'),
			// name: '',
			// librarianId: '',
			// telnum: "",
			// sex: "",
			// librarianId: "",
			// age: "",
			// region: "",
			// cardNum: "",
			// tradeName: "",
			// jobName: "",
			// salaryExpectation: "",
			// originalCompany: "",
			// originalCity: "",
			// annualSalary: "",
			// type: "",
			// belows: '',
			// projectBelongs: '',
			// projectBelong: '',
			// comment: '',
			// workStatus: '',
			// projectId: '',

			this.widPersnt = '60%'
			this.formExport = data
			this.formExport.appUserid = data.userid

			this.formExport.inputName = localStorage.getItem('checkHuman')
			if (data.nickname != '') {
				this.formExport.name = data.nickname
			}
			if (data.cardnum != undefined) {
				this.formExport.cardNum = data.cardnum
			}
			console.log(data);
			this.toolDialog.exportShow = true
		},
		//初始化
		init() {
			localStorage.setItem('pageTitle', '招聘信息录入');
			this.$store.dispatch('setPageTitle', localStorage.getItem('pageTitle'));
			this.getDataList();
			let workers = require('@/assets/mask/positionList.json');
			this.workersList = workers.position; //职能类型
			this.getSearchList()
		},
		//条件搜索
		searchData(data) {
			console.log(data);
			this.search.data = data;
			this.getDataList(data);
		},
		handleChangeCode(data, index) {
			console.log(data);
			if (data.length == 0) {
				return this.formSeach.tradeName = ''
			}
			if (index == '11') {
				this.formSeach.tradeName = this.$refs.cascader.getCheckedNodes()[0].label
			}
			if (index == '22') {
				this.workersList.forEach(res => {
					res.children.forEach(res1 => {
						res1.children.forEach(res2 => {
							if (data[2] == res2.value) {
								this.formExport.tradeName = res2.label
							}
						})
					})
				})
			}
			console.log(this.formSeach.tradeName);
			console.log(this.formExport.tradeName);
		},

		//获取数据列表
		getDataList(form) {
			let params = {
				userId: localStorage.getItem('userid'),
				pagenum: this.cur,
				pagesize: this.pageSize,
				type: 0,
			}
			if (form) {
				params = Object.assign(params, form)
			};
			this.$telAxios.post('/v1/platform/member/list', params).then(res => {
				console.log(res);
				if (res.data.code === 1) {
					let result = res.data.data.list;
					this.totalNum = Number(res.data.data.totalnum);

					result.forEach(item => {
						item.resume = '查看简历';
						// 状态(1:沟通;2:通知面试；3:实到面试;通知复试:4;实到复试:5;录取:6;到岗:7)
						if (item.status == 1) {
							item.workStatus = '正在找工作'
						} else if (item.status == 2) {
							item.workStatus = '在职，正考虑换个新环境'
						} else if (item.status == 3) {
							item.workStatus = '在职，暂无跳槽打算'
						} else if (item.status == 4) {
							item.workStatus = '在职，有更好的机会也可以考虑'
						} else if (item.status == 5) {
							item.workStatus = '我要招聘'
						} else if (item.status == 6) {
							item.workStatus = '已入职试用'
						} else if (item.status == 7) {
							item.workStatus = '到岗'
						}
						if (item.sex == 1) {
							item.sex = '男'
						}
						if (item.sex == '2') {
							item.sex = '女';
						}
					});

					this.tableData.data = result;
					this.tableData.data.forEach(item => {
						// if(item.rlist.length>0){
						// 	 item.rlist.forEach(data=>{
						// 		 item.recruitmentChannel+=data+'\n'
						// 	 })	
						// 	item.recruitmentChannel= item.recruitmentChannel.substring(9)
						// }
					})
				} else {
					this.$message({
						message: res.data.message,
						type: 'warning'
					})
				}
			})
		},
		//新增资料
		addMaterial(form) {
			console.log(form);
			let params = {
				userId: localStorage.getItem('userid'),
				userName: localStorage.getItem('checkHuman')
			}
			if (form) {
				params = Object.assign(params, form)
			};
			console.log(params);
			// params.projectBelongs=
			this.$telAxios.post('/v1/librarian/inserLibrarian', params).then(res => {
				console.log(res);
				if (res.data.code === 1000) {
					this.$message({
						message: '录入成功！',
						type: 'success'
					})
					this.getDataList();
					this.$refs.material.clearData();
					this.getDataList();
				} else {
					this.$message({
						message: res.data.message,
						type: 'warning'
					})
				}
			})
		},
		//打开修改数据弹窗
		openModifyDialog(data, type) {
			console.log(data);
			console.log(type);
			this.updateData.showDialog = true;
			this.updateData.type = type;
			this.updateData.userInfo = data;
			let projectId = '';
			this.$telAxios.get('/v1/librarian/projectBelongsList', {}).then(item => {
				let dat = item.data.data
				dat.forEach(r => {
					if (r.projectBlongs == data.projectBelongs) {
						this.projectId = r.projectId
						console.log(r.projectId);
					}
				})
				this.$telAxios.get('/v1/librarian/pecruitmentChannelByProjectId?projectId=' + this
					.projectId, {}).then(res => {
						this.updateData.recruitmentChannelList = res.data.data
						console.log(res);
					})
			})



		},
		//更新数据
		modifyData(data) {
			console.log(data);
			this.updateData.showDialog = false;
			let params = {
				librarianId: this.updateData.userInfo.librarianId,
				changedFront: this.updateData.userInfo[this.updateData.type],
				changedQueen: data,
				userId: localStorage.getItem('userid'),
				userName: localStorage.getItem('checkHuman'),
				projectId: this.projectId,
			}
			this.updateData.type == 'name' ? params.grade = 1 : '';
			this.updateData.type == 'telnum' ? params.grade = 2 : '';
			this.updateData.type == 'position' ? params.grade = 3 : '';
			this.updateData.type == 'workStatus' ? params.grade = 4 : '';
			this.updateData.type == 'projectBelongs' ? params.grade = 5 : '';
			this.updateData.type == 'arrange' ? params.grade = 6 : '';
			this.updateData.type == 'sex' ? params.grade = 10 : '';
			this.updateData.type == 'age' ? params.grade = 11 : '';
			this.updateData.type == 'education' ? params.grade = 12 : '';
			this.updateData.type == 'nativePlace' ? params.grade = 13 : '';
			this.updateData.type == 'region' ? params.grade = 18 : '';
			// this.updateData.type == 'hiredate' ? params.grade = 16 : '';
			this.updateData.type == 'recruitmentChannel' ? params.grade = 17 : '';
			this.updateData.type == 'interviewTime' ? params.grade = 16 : '';
			this.updateData.type == 'cardNum' ? params.grade = 19 : '';
			this.updateData.type == 'tradeName' ? params.grade = 20 : '';
			this.updateData.type == 'jobName' ? params.grade = 21 : '';
			this.updateData.type == 'salaryExpectation' ? params.grade = 22 : '';
			this.updateData.type == 'originalCompany' ? params.grade = 23 : '';
			this.updateData.type == 'originalCity' ? params.grade = 24 : '';
			this.updateData.type == 'annualSalary' ? params.grade = 25 : '';
			// this.updateData.type == 'hoppingIntention' ? params.grade = 19 : '';


			this.$telAxios.post('/v1/librarian/insertDetail', params).then(res => {
				console.log(res);
				if (res.data.code === 1000) {
					if (this.updateData.type == 'projectBelongs') {
						params.changedFront = this.updateData.userInfo['recruitmentChannel']
						params.grade = 17
						params.changedQueen = ''
						this.$telAxios.post('/v1/librarian/insertDetail', params).then(res => { })
					}
					this.$message({
						message: '修改成功！',
						type: 'success'
					})
					this.searchData(this.search.data);
				} else {
					this.$message({
						message: res.data.message,
						type: 'warning'
					})
				}
			})




		},
		//打开新增备注模板
		addRemarks(data) {
			console.log(data);
			this.remarksData.showDialog = true;
			this.remarksData.textarea = data.newRemarks;
			this.remarksData.userInfo = data
		},
		//打开简历模板
		openResume(data) {
			console.log(data);
			this.remuseData.showDialog = true;
			this.$telAxios.post('/v1/librarian/selectFlexibileResumeList', {
				librarianId: data.librarianId
			}).then(res => {
				console.log(res);
				if (res.data.code === 1000) {
					this.remuseData.list = res.data.data;
				} else {
					this.$message({
						message: res.data.message,
						type: 'warning'
					})
				}
			})
		},
		//上传完简历之后更新视图
		updateView(msg) {
			this.uploadData.showDialog = false;
			let params = {
				librarianId: this.uploadData.userInfo.librarianId,
				changedFront: '上传一条简历',
				changedQueen: '上传的简历名为：' + msg,
				grade: '8'
			}
			this.$telAxios.post('/v1/librarian/insertDetail', params).then(res => {
				console.log(res);
				if (res.data.code === 1000) {

				} else {
					this.$message({
						message: res.data.message,
						type: 'warning'
					})
				}
			})
			this.searchData(this.search.data);
		},
		//提交新增备注数据
		subRemarks(data) {
			console.log(data);
			let params = {
				librarianId: this.remarksData.userInfo.librarianId,
				changedFront: this.remarksData.userInfo.newRemarks,
				changedQueen: data,
				grade: 7,
				userId: localStorage.getItem('userid'),
				userName: localStorage.getItem('checkHuman'),

			}
			this.$telAxios.post('/v1/librarian/insertDetail', params).then(res => {
				console.log(res);
				if (res.data.code === 1000) {
					this.$message({
						message: '新增备注成功！',
						type: 'success'
					})
					this.$refs.remark.clearData();
					this.searchData(this.search.data);
				} else {
					this.$message({
						message: res.data.message,
						type: 'warning'
					})
				}
			})
			this.remarksData.showDialog = false;
		},
		//打开修改明细和备注弹窗
		openDetailsDialog(type, data) {
			console.log(type);
			console.log(data);
			this.detailsData.type = type;
			this.detailsData.userInfo = data;
			this.detailsData.showDialog = true;
			this.detailsData.title = type == '明细' ? '修改明细' : '备注';
			this.getDetailsList({
				cur: 1,
				pageSize: 10
			});
		},
		//获取明细/备注列表
		getDetailsList(obj) {
			let params = {
				librarianId: this.detailsData.userInfo.librarianId,
				pageNum: obj.cur,
				pageSize: obj.pageSize
			}
			let url = this.detailsData.type == '明细' ? '/v1/librarian/selectDetailBylibrarianId' :
				'/v1/librarian/selectPostscriptVoList';
			this.$telAxios.post(url, params).then(res => {
				console.log(res);
				if (res.data.code === 1000) {
					let result = res.data.data;
					if (this.detailsData.type == '明细') {
						result.dlist.forEach(item => {
							let mold = '修改类型：';
							if (item.grade == 1) {
								mold += '姓名';
							} else if (item.grade == 2) {
								mold += '手机号';
							} else if (item.grade == 3) {
								mold += '岗位';
							} else if (item.grade == 4) {
								mold += '工作状态';
							} else if (item.grade == 5) {
								mold += '项目归属';
							} else if (item.grade == 6) {
								mold += '标注';
							} else if (item.grade == 7) {
								mold += '备注';
							} else if (item.grade == 10) {
								mold += '性别';
							} else if (item.grade == 11) {
								mold += '年龄';
							} else if (item.grade == 12) {
								mold += '学历';
							} else if (item.grade == 13) {
								mold += '籍贯';
							} else if (item.grade == 14) {
								mold += '现住址';
							} else if (item.grade == 16) {
								mold += '面试时间';
							} else if (item.grade == 17) {
								mold += '招聘渠道';
							} else if (item.grade == 18) {
								mold += '居住地';
							} else if (item.grade == 19) {
								mold += '身份证号码';
							} else if (item.grade == 20) {
								mold += '职能';
							} else if (item.grade == 21) {
								mold += '职位';
							} else if (item.grade == 22) {
								mold += '期望薪资';
							} else if (item.grade == 23) {
								mold += '原公司城市';
							} else if (item.grade == 24) {
								mold += '原工作单位';
							} else if (item.grade == 25) {
								mold += '原年薪';
							}

							if (item.grade == 4) {
								if (item.changedFront == 1) {
									item.changedFront = '沟通'
								} else if (item.changedFront == 2) {
									item.changedFront = '通知面试'
								} else if (item.changedFront == 3) {
									item.changedFront = '实到面试'
								} else if (item.changedFront == 4) {
									item.changedFront = '实到复试'
								} else if (item.changedFront == 5) {
									item.changedFront = '录取'
								} else if (item.changedFront == 6) {
									item.changedFront = '到岗'
								} else if (item.changedFront == 7) {
									item.changedFront = '入职'
								}

								if (item.changedQueen == 1) {
									item.changedQueen = '沟通'
								} else if (item.changedQueen == 2) {
									item.changedQueen = '通知面试'
								} else if (item.changedQueen == 3) {
									item.changedQueen = '实到面试'
								} else if (item.changedQueen == 4) {
									item.changedQueen = '实到复试'
								} else if (item.changedQueen == 5) {
									item.changedQueen = '录取'
								} else if (item.changedQueen == 6) {
									item.changedQueen = '到岗'
								} else if (item.changedQueen == 7) {
									item.changedQueen = '入职'
								}

							}
							item.comment = mold + '<br/>' + ' 修改前内容：' + item.changedFront
							if (item.changedQueen) {
								item.comment += '<br/> 修改后内容：' + item.changedQueen;
							}


							if (item.grade == 8) {
								item.comment = '操作类型：上传一条简历' + '<br/>' + item.changedQueen;
							}
							item.comment +=
								`<br/><span style="color:red">修改人姓名:${item.userName}</span>`
						})
						this.detailsData.list = result.dlist;
					} else {
						this.detailsData.list = result.plist;
					}
					this.detailsData.totalNum = Number(result.totalNum);
				} else {
					this.$message({
						message: res.data.message,
						type: 'warning'
					})
				}
			})
		},
		//打开上传弹窗
		openUpload(data) {
			console.log(data);
			this.uploadData.showDialog = true;
			this.uploadData.userInfo = data;
			this.uploadData.fileList = [];
		},
		//提交数据放入回收站
		recovery(data) {
			console.log(data);
			this.$confirm('是否确认放入回收站？', '放入回收站', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning',
			}).then(() => {
				this.$telAxios.post('/v1/librarian/updateLibrarianRecycleBin', {
					librarianId: data.librarianId,
					recycleBin: 1
				}).then(res => {
					console.log(res);
					if (res.data.code === 1000) {
						this.$message({
							message: '放入回收站操作成功！',
							type: 'success'
						})
						this.searchData(this.search.data);
					} else {
						this.$message({
							message: res.data.message,
							type: 'warning'
						})
					}
				})
			}, () => {
				console.log('取消成功！');
			})
		},

		//当前页是第几页,点击的第几页的时候调用这个函数
		pageChange(p) {
			// 点击的时候传过来一个参数，这个参数就是所点击的当前页数，
			// 然后把这个当前页数转换成字符串形式赋值给page，
			// 然后把page这个参数传给search这个方法
			console.log(p);
			this.cur = p;
			this.searchData(this.search.data);
		},
		//每页有多少条,10,20,50等,点击选择的时候调用这个方法
		handleSizeChange(val) {
			console.log(val);
			this.pageSize = val;
			this.searchData(this.search.data);
		},
	}
}
</script>

<style scoped="scoped">
.container {
	background-color: #fff;
	height: 100%;
	padding-left: 20px;
}

.header-title {
	padding: 0 0 20px 0;
	border-bottom: 1px solid #D2D2D2;
}

.addTab /deep/ .caret-wrapper {
	display: none;
}

.serchBtn {
	border-radius: 5px;
	padding: 8px 25px;
	border: none;

}

.exporBtn {
	margin-top: 40px;
	padding: 16px 38px;
	color: white;
	background: #5492CC;
}

.header-title span {
	width: 15px;
	float: left;
	height: 30px;
	background-color: #0064E4;
	margin-right: 20px;
}

.markBox {
	padding: 0 20px;
	margin-top: -17px;
}

.inputBox {
	padding: 20px;

}

.inputIcon {
	text-align: center;
	padding-bottom: 13px;
	font-size: 26px;
	border-bottom: 1px solid rgb(241, 241, 241);
	margin-bottom: 28px;

}

.centerH5 {
	text-align: center;
	margin-bottom: 10px;
	font-size: 15px;

}

.markArea {
	border-radius: 10px;
	background-color: rgb(247, 247, 247);
	color: red;
	height: 50px;
	line-height: 50px;
	padding: 0 10px;
	font-size: 16px;
}

.header-title p {
	font-size: 16px;
	font-family: PingFang SC;
	line-height: 30px;
	float: left;

}

.pBox {
	width: 250px;
	text-align: center;
	/* border: 1px solid #DCDFE6; */
	border-radius: 10px;
	height: 42px;
	cursor: pointer;
}

.pBox .upIcon {
	font-size: 40px;
}

.itemForm {
	margin-right: 80px;
}

.pageBox {
	margin-top: 20px;
}

.textAl {
	text-align: center;
}

.width {
	width: 250px;
}
</style>
